import 'dart:io';

import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_picker/image_picker.dart';
import 'package:studymanage/core/event_bus.dart';
import 'package:studymanage/core/global.dart';
import 'package:studymanage/core/request_model.dart';
import 'package:studymanage/login/login.dart';
import 'package:studymanage/util/project_config.dart';
import 'package:studymanage/util/request.dart';
import 'package:path/path.dart' as path;

class Personal extends StatefulWidget {
  final Map userInfo;
  final setUserInfo;

  Personal(this.userInfo,this.setUserInfo);

  @override
  State<StatefulWidget> createState() {
    return PersonalState();
  }
}

class PersonalState extends State<Personal>{
  File _image;
  final GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
  Map user;
 // 相册选择
  Future _getImageFromGallery() async {
    var image = await ImagePicker.pickImage(source: ImageSource.gallery);
    Upload().upload("/multiapi/open/upload",
        FormData.fromMap({"file":  await MultipartFile.fromFile(image.path,filename: path.basename(image.path))})
    ).then((response){
      setState(() {
        user['avatar'] = response.data['url'];
      });
    });
    if (image != null) {
      setState(() {
        _image = image;
        print(_image);
      });
    }
  }

  @override
  void initState() {
    super.initState();
    setState(() {
      user = widget.userInfo;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color.fromRGBO(248, 248, 248, 1),
      body: SingleChildScrollView(
        child: Stack(
          alignment: Alignment.topCenter,
          children: <Widget>[
            Container(
              width: MediaQuery.of(context).size.width,
              child: Column(
                children: <Widget>[
                  Container(
                    width: MediaQuery.of(context).size.width,
                    height: ScreenUtil().setHeight(220),
                    padding: EdgeInsets.only(
                      top: ScreenUtil().setHeight(85),
                    ),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: AssetImage('assets/images/mine/mine_bg.png'),
                        fit: BoxFit.fill,
                      ),
                    ),
                    child: Column(
                      children: <Widget>[
                        Container(
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            border: Border.all(
                              color: Colors.white,
                              width: ScreenUtil().setHeight(2),
                            ),
                            borderRadius: BorderRadius.circular(ScreenUtil().setHeight(39)),
                          ),
                          child: CircleAvatar(
                            radius: ScreenUtil().setHeight(38),
                            backgroundImage: _image != null ? FileImage(_image) : widget.userInfo['avatar']!=null ? NetworkImage(widget.userInfo['avatar']):Image.asset("assets/images/mine/mine_bg.png").image,
                            backgroundColor: Colors.transparent,
                          ),
                        ),
                        Container(
                          width: ScreenUtil().setWidth(65),
                          height: ScreenUtil().setHeight(25),
                          margin: EdgeInsets.only(
                            top: ScreenUtil().setHeight(10),
                          ),
                          decoration: BoxDecoration(
                            border: Border.all(
                              width: ScreenUtil().setHeight(1),
                              color: Colors.white,
                            ),
                            borderRadius: BorderRadius.all(
                              Radius.circular(ScreenUtil().setHeight(2)),
                            ),
                          ),
                          child: FlatButton(
                            padding: EdgeInsets.all(0),
                            child: Text(
                              '重新上传',
                              style: TextStyle(
                                fontFamily: 'PingFangSC-Medium',
                                fontSize: ScreenUtil().setSp(12),
                                fontWeight: FontWeight.w600,
                                color: Colors.white,
                              ),
                            ),
                            onPressed: () {
                              print('图片上传');
                              _getImageFromGallery();
                            },
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                      width: MediaQuery.of(context).size.width,
                      padding: EdgeInsets.only(
                        left: ScreenUtil().setWidth(16.5),
                        right: ScreenUtil().setWidth(16.5),
                      ),
                      color: Colors.white,
                      child: Form(
                        key: _formKey,
                        child: Column(
                          children: <Widget>[
                            Container(
                              height: ScreenUtil().setHeight(50),
                              decoration: BoxDecoration(
                                border: Border(
                                    bottom: BorderSide(
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                      width: ScreenUtil().setHeight(0.5),
                                    )
                                ),
                              ),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Text(
                                    '昵称',
                                    style: TextStyle(
                                      fontFamily: 'PingFangSC-Light',
                                      fontSize: ScreenUtil().setSp(14),
                                      fontWeight: FontWeight.w600,
                                      color: Color.fromRGBO(51, 51, 51, 1),
                                    ),
                                  ),
                                  Container(
                                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                    margin: EdgeInsets.only(
                                      left: ScreenUtil().setWidth(23.5),
                                    ),
                                    child: TextFormField(
                                      initialValue: widget.userInfo['nickname'],
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(153, 153, 153, 1),
                                        height: 1,
                                      ),
                                      decoration: InputDecoration(
                                        border: InputBorder.none,
                                      ),
                                      onSaved: (v) {
                                        setState(() {
                                          user['nickname'] = v;
                                        });
                                      },
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              height: ScreenUtil().setHeight(50),
                              decoration: BoxDecoration(
                                border: Border(
                                    bottom: BorderSide(
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                      width: ScreenUtil().setHeight(0.5),
                                    )
                                ),
                              ),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Text(
                                    '姓名',
                                    style: TextStyle(
                                      fontFamily: 'PingFangSC-Light',
                                      fontSize: ScreenUtil().setSp(14),
                                      fontWeight: FontWeight.w600,
                                      color: Color.fromRGBO(51, 51, 51, 1),
                                    ),
                                  ),
                                  Container(
                                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                    margin: EdgeInsets.only(
                                      left: ScreenUtil().setWidth(23.5),
                                    ),
                                    child: TextFormField(
                                      enabled: false,
                                      initialValue: widget.userInfo['name'],
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(153, 153, 153, 1),
                                        height: 1,
                                      ),
                                      decoration: InputDecoration(
                                        border: InputBorder.none,
                                      ),
                                      onSaved: (v) {
                                        setState(() {
                                          user['name'] = v;
                                        });
                                      },
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              height: ScreenUtil().setHeight(50),
                              decoration: BoxDecoration(
                                border: Border(
                                    bottom: BorderSide(
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                      width: ScreenUtil().setHeight(0.5),
                                    )
                                ),
                              ),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Text(
                                    '手机',
                                    style: TextStyle(
                                      fontFamily: 'PingFangSC-Light',
                                      fontSize: ScreenUtil().setSp(14),
                                      fontWeight: FontWeight.w600,
                                      color: Color.fromRGBO(51, 51, 51, 1),
                                    ),
                                  ),
                                  Container(
                                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                    margin: EdgeInsets.only(
                                      left: ScreenUtil().setWidth(23.5),
                                    ),
                                    child: TextFormField(
                                      enabled: false,
                                      initialValue: widget.userInfo['phone'],
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(153, 153, 153, 1),
                                        height: 1,
                                      ),
                                      decoration: InputDecoration(
                                        border: InputBorder.none,
                                      ),
                                      keyboardType: TextInputType.phone,
                                      onSaved: (v) {
                                        user['phone'] = v;
                                      },
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              height: ScreenUtil().setHeight(50),
                              decoration: BoxDecoration(
                                border: Border(
                                    bottom: BorderSide(
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                      width: ScreenUtil().setHeight(0.5),
                                    )
                                ),
                              ),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Text(
                                    '性别',
                                    style: TextStyle(
                                      fontFamily: 'PingFangSC-Light',
                                      fontSize: ScreenUtil().setSp(14),
                                      fontWeight: FontWeight.w600,
                                      color: Color.fromRGBO(51, 51, 51, 1),
                                    ),
                                  ),
                                  Container(
                                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                    margin: EdgeInsets.only(
                                      left: ScreenUtil().setWidth(23.5),
                                    ),
                                    child: TextFormField(
                                      enabled: false,
                                      initialValue: widget.userInfo['gender'],
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(153, 153, 153, 1),
                                        height: 1,
                                      ),
                                      decoration: InputDecoration(
                                        border: InputBorder.none,
                                      ),
                                      onSaved: (v) {
                                        setState(() {
                                          user['gender'] =v;
                                        });
                                      },
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              decoration: BoxDecoration(
                                border: Border(
                                    bottom: BorderSide(
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                      width: ScreenUtil().setHeight(0.5),
                                    )
                                ),
                              ),
                              height: ScreenUtil().setHeight(50),
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: <Widget>[
                                  Text(
                                    '地区',
                                    style: TextStyle(
                                      fontFamily: 'PingFangSC-Light',
                                      fontSize: ScreenUtil().setSp(14),
                                      fontWeight: FontWeight.w600,
                                      color: Color(0xff333333),
                                    ),
                                  ),
                                  Container(
                                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                    margin: EdgeInsets.only(
                                      left: ScreenUtil().setWidth(23.5),
                                    ),
                                    child: TextFormField(
                                      enabled: false,
                                      initialValue: widget.userInfo['address'],
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(153, 153, 153, 1),
                                        height: 1,
                                      ),
                                      decoration: InputDecoration(
                                        border: InputBorder.none,
                                      ),
                                      onSaved: (v) {
                                        user['address'] =v;
                                      },
                                    ),
                                  ),

                                ],
                              ),
                            ),
                            Offstage(
                              offstage: Global.profile.userTypeEnum==1,
                              child: Container(
                                height: ScreenUtil().setHeight(50),
                                decoration: BoxDecoration(
                                  border: Border(
                                      bottom: BorderSide(
                                        color: Color.fromRGBO(238, 238, 238, 1),
                                        width: ScreenUtil().setHeight(0.5),
                                      )
                                  ),
                                ),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      '级别',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color(0xff333333),
                                      ),
                                    ),
                                    Container(
                                      width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                      margin: EdgeInsets.only(
                                        left: ScreenUtil().setWidth(23.5),
                                      ),
                                      child: TextFormField(
                                        enabled: false,
                                        initialValue: widget.userInfo['level'],
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Light',
                                          fontSize: ScreenUtil().setSp(14),
                                          fontWeight: FontWeight.w600,
                                          color: Color.fromRGBO(153, 153, 153, 1),
                                          height: 1,
                                        ),
                                        decoration: InputDecoration(
                                          border: InputBorder.none,
                                        ),
                                        onSaved: (v) {
                                        },
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                            Offstage(
                              offstage: Global.profile.userTypeEnum==1,
                              child: Container(
                                height: ScreenUtil().setHeight(50),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      '简介',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color(0xff333333),
                                      ),
                                    ),
                                    Container(
                                      width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                      margin: EdgeInsets.only(
                                        left: ScreenUtil().setWidth(23.5),
                                      ),
                                      child: TextFormField(
                                        enabled: false,
                                        minLines: 1,
                                        maxLines: 3,
                                        initialValue: widget.userInfo['intro'],
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Light',
                                          fontSize: ScreenUtil().setSp(14),
                                          fontWeight: FontWeight.w600,
                                          color: Color.fromRGBO(153, 153, 153, 1),
                                          height: 1,
                                        ),
                                        decoration: InputDecoration(
                                          border: InputBorder.none,
                                        ),
                                        onSaved: (v) {
                                          user['intro'] =v;
                                        },
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                            Offstage(
                              offstage: Global.profile.userTypeEnum==2,
                              child: Container(
                                decoration: BoxDecoration(
                                  border: Border(
                                      bottom: BorderSide(
                                        color: Color.fromRGBO(238, 238, 238, 1),
                                        width: ScreenUtil().setHeight(0.5),
                                      )
                                  ),
                                ),
                                height: ScreenUtil().setHeight(50),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      '班级',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color(0xff333333),
                                      ),
                                    ),
                                    Container(
                                      width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                      margin: EdgeInsets.only(
                                        left: ScreenUtil().setWidth(23.5),
                                      ),
                                      child: TextFormField(
                                        enabled: false,
                                        initialValue: widget.userInfo['className'],
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Light',
                                          fontSize: ScreenUtil().setSp(14),
                                          fontWeight: FontWeight.w600,
                                          color: Color.fromRGBO(153, 153, 153, 1),
                                          height: 1,
                                        ),
                                        decoration: InputDecoration(
                                          border: InputBorder.none,
                                        ),
                                        onSaved: (v) {
                                        },
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                            Offstage(
                              offstage: Global.profile.userTypeEnum==2,
                              child: Container(
                                decoration: BoxDecoration(
                                  border: Border(
                                      bottom: BorderSide(
                                        color: Color.fromRGBO(238, 238, 238, 1),
                                        width: ScreenUtil().setHeight(0.5),
                                      )
                                  ),
                                ),
                                height: ScreenUtil().setHeight(50),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      '导师',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color(0xff333333),
                                      ),
                                    ),
                                    Container(
                                      width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                      margin: EdgeInsets.only(
                                        left: ScreenUtil().setWidth(23.5),
                                      ),
                                      child: TextFormField(
                                        enabled: false,
                                        initialValue: widget.userInfo['teacherName'],
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Light',
                                          fontSize: ScreenUtil().setSp(14),
                                          fontWeight: FontWeight.w600,
                                          color: Color.fromRGBO(153, 153, 153, 1),
                                          height: 1,
                                        ),
                                        decoration: InputDecoration(
                                          border: InputBorder.none,
                                        ),
                                        onSaved: (v) {
                                        },
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                            Offstage(
                              offstage: Global.profile.userTypeEnum==2,
                              child: Container(
                                height: ScreenUtil().setHeight(50),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Text(
                                      '介绍',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Light',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color(0xff333333),
                                      ),
                                    ),
                                    Container(
                                      width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(90),
                                      margin: EdgeInsets.only(
                                        left: ScreenUtil().setWidth(23.5),
                                      ),
                                      child: TextFormField(
                                        maxLines: null,
                                        initialValue: widget.userInfo['intro'],
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Light',
                                          fontSize: ScreenUtil().setSp(14),
                                          fontWeight: FontWeight.w600,
                                          color: Color.fromRGBO(153, 153, 153, 1),
                                          height: 1,
                                        ),
                                        decoration: InputDecoration(
                                          border: InputBorder.none,
                                        ),
                                        keyboardType: TextInputType.text,
                                        onSaved: (v) {
                                          user['intro'] =v;
                                        },
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                          ],
                        ),
                      )
                  ),
                  Container(
                    width: MediaQuery.of(context).size.width - ScreenUtil().setWidth(30),
                    margin: EdgeInsets.only(
                        right: 30,
                        left: 30,
                        top: 30,
                        bottom: 30
                    ),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(5),
                      color: Colors.white,
                    ),
                    child: FlatButton(
                      child: Text('退出登录',
                        style: TextStyle(
                          fontFamily: 'PingFangSC-Regular',
                          fontSize: ScreenUtil().setSp(16),
                          color: Color.fromRGBO(51, 51, 51, 1),
                        ),
                      ),
                      onPressed: () {
                        showDialog(
                          context: context,
                          builder: (BuildContext context) {
                            return AlertDialog(
                              contentPadding: EdgeInsets.all(0),
                              actionsPadding: EdgeInsets.all(0),
                              buttonPadding: EdgeInsets.all(0),
                              insetPadding: EdgeInsets.all(0),
                              content: Container(
                                width: ScreenUtil().setWidth(300),
                                decoration: BoxDecoration(
                                  border: Border(
                                    bottom: BorderSide(
                                      width: ScreenUtil().setHeight(0.5),
                                      color: Color.fromRGBO(238, 238, 238, 1),
                                    ),
                                  ),
                                ),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Container(
                                      margin: EdgeInsets.only(
                                        top: ScreenUtil().setHeight(40.5),
                                        bottom: ScreenUtil().setHeight(32),
                                      ),
                                      child: Text('确定退出登录？',
                                        style: TextStyle(
                                          fontFamily: 'PingFangSC-Regular',
                                          fontSize: ScreenUtil().setSp(14),
                                          color: Color.fromRGBO(25, 28, 34, 1),
                                          height: 1,
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              actions: <Widget>[
                                Container(
                                  width: ScreenUtil().setWidth(150),
                                  height: ScreenUtil().setHeight(40),
                                  decoration: BoxDecoration(
                                    border: Border(
                                      right: BorderSide(
                                        width: ScreenUtil().setHeight(0.5),
                                        color: Color.fromRGBO(238, 238, 238, 1),
                                      ),
                                    ),
                                  ),
                                  child: FlatButton(
                                    child: Text('取消',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Medium',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(102, 102, 102, 1),
                                        height: 1,
                                      ),
                                    ),
                                    onPressed: () {
                                      Navigator.pop(context);
                                    },
                                  ),
                                ),
                                Container(
                                  width: ScreenUtil().setWidth(150),
                                  height: ScreenUtil().setHeight(40),
                                  child: FlatButton(
                                    child: Text('确认',
                                      style: TextStyle(
                                        fontFamily: 'PingFangSC-Medium',
                                        fontSize: ScreenUtil().setSp(14),
                                        fontWeight: FontWeight.w600,
                                        color: Color.fromRGBO(214, 178, 128, 1),
                                        height: 1,
                                      ),
                                    ),
                                    onPressed: () {
                                      Request().post("/multiapi/logout").then((response){
                                        Global.profile =new Profile();
                                        Global.saveProfile();
                                        eventBus.fire(LoadingEvent(true,40001));
                                        eventBus.fire(RequestEvent(ResponseModel(code: 40001)));
                                        Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => Login(1)), (route) => false);

                                      });
                                    },
                                  ),
                                ),
                              ],
                            );
                          },
                        );
                      },
                    ),
                  )
                ],
              ),
            ),

            AppBar(
              brightness: Brightness.light,
              title: Text('个人资料',
                style: TextStyle(
                  fontFamily: 'PingFangSC-Medium',
                  fontSize: ScreenUtil().setSp(16),
                  fontWeight: FontWeight.w600,
                  color: Colors.white,
                  height: 1,
                ),
              ),
              centerTitle: true,
              backgroundColor: Colors.transparent,
              elevation: 0,
              leading: FlatButton(
                child: Icon(
                  Icons.navigate_before,
                  color: Colors.white,
                ),
                onPressed: () {
                  Navigator.pop(context);
                },
              ),
              actions: <Widget>[
                Container(
                  width: ScreenUtil().setWidth(60),
                  child: FlatButton(
                    padding: EdgeInsets.only(
                      left: ScreenUtil().setWidth(15.5),
                      right: ScreenUtil().setWidth(15.5),
                    ),
                    child: Text('保存',
                      style: TextStyle(
                        fontFamily: 'PingFangSC-Regular',
                        fontSize: ScreenUtil().setSp(13),
                        color: Colors.white,
                        height: 1,
                      ),
                    ),
                    onPressed: () {
                      _formKey.currentState.save();
                      Request().post("/multiapi/c213v_userData",data: {
                        "nickname":user['nickname'],
                        "avatar": user['avatar'],
                        "intro": user['intro']
                      }).then((value){
                        widget.setUserInfo(user);
                        Navigator.pop(context);
                      });
                    },
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}